<?php
/**
 * A unique identifier is defined to store the options in the database and reference them from the theme.
 * By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
 * If the identifier changes, it'll appear as if the options have been reset.
 *
 */

function optionsframework_option_name() {
	// This gets the theme name from the stylesheet (lowercase and without spaces)
	$themename = get_option( 'stylesheet' );
	$themename = preg_replace("/\W/", "_", strtolower($themename) );

	$optionsframework_settings = get_option('apollo_optionsframework');
	$optionsframework_settings['id'] = $themename;
	update_option('apollo_optionsframework', $optionsframework_settings);
}

/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the 'id' fields, make sure to use all lowercase and no spaces.
 *
 */

function optionsframework_options() {

	$options = array();

	// Header Options Area
	$options[] = array(
		'name' => __( 'Display', 'apollo' ),
		'type' => 'heading'
	);
    
    $options[] = array(
        'name' 		=> __( 'Header', 'apollo' ),
        'desc' 	=> __( '', 'apollo' ),
        'id' 		=> 'apollo_header',
        'std' 	=> render_php_to_string( APOLLO_THEME_HEADER ),
        'type' 	=> 'editor',
    );
    
    $options[] = array(
        'name' 		=> __( 'Footer', 'apollo' ),
        'desc' 	=> __( '', 'apollo' ),
        'id' 		=> 'apollo_footer',
        'std' 	=> render_php_to_string( APOLLO_THEME_FOOTER ),
        'type' 	=> 'editor',
    );
    
    $options[] = array(
        'name' 		=> __( 'Site Info', 'apollo' ),
        'desc' 	=> __( '', 'apollo' ),
        'id' 		=> 'apollo_site_info',
        'std' 	=> render_php_to_string( APOLLO_THEME_SITE_INFO ),
        'type' 	=> 'editor',
    );
    
    $options[] = array(
        'name' 		=> __( 'Override css', 'apollo' ),
        'desc' 	=> __( 'Content of css override file here', 'apollo' ),
        'id' 		=> 'apollo_override_css',
        'std' 	=> '',
        'type' 	=> 'editor',
    );

	/*************************************************************************/

	$options[] = array(
		'name' => __( 'Design', 'apollo' ),
		'type' => 'heading'
	);

	$options[] = array(
		'name' 		=> __( 'Default layout homepage', 'apollo' ),
		'desc' 		=> __( '', 'apollo' ),
        'id'        => 'apollo_default_layout',
		'std' 		=> APOLLO_DEFAULT_LAYOUT,
		'type' 		=> 'images',
		'options' 	=> array(
            'right_sidebar_one_column'     => APOLLO_ADMIN_IMAGES_URL . '/right-sidebar-one-column.png',
            'right_sidebar_two_columns'    => APOLLO_ADMIN_IMAGES_URL . '/right-sidebar-two-columns.png',
        )
	);

    // Site primary color option
	$options[] = array(
		'name' 		=> __( 'Primary color option', 'apollo' ),
		'desc' 		=> __( '', 'apollo' ),
		'id' 			=> 'apollo_primary_color',
		'std' 		=> APOLLO_THEME_PRIMARY_COLOR,
		'type' 		=> 'color' 
	);
    
	/*************************************************************************/
    
    $options[] = array(
		'name' => __( 'Site Config', 'apollo' ),
		'type' => 'heading'
	);
    
    // Header logo and text display type option
	$activate_spotlight_array = array(
		1	=> __( 'Yes', 'apollo' ),
		0 	=> __( 'No', 'apollo' ),
	);
    
    // Spotlight activate option
	$options[] = array(
		'name' 		=> __( 'Activate Spotlight', 'apollo' ),
		'desc' 		=> __( '', 'apollo' ),
		'id' 			=> 'apollo_activate_spotlight',
		'std' 		=> APOLLO_THEME_ACTIVATE_SPOTLIGHT,
		'type' 		=> 'radio',
        'options'   => $activate_spotlight_array,
	);
    
    // Header logo and text display type option
	$activate_override_css_array = array(
		1 	=> __( 'Yes', 'apollo' ),
		0 	=> __( 'No', 'apollo' ),
	);
    
    // Override CSS activate option
    $options[] = array(
		'name' 		=> __( 'Activate Override CSS', 'apollo' ),
		'id' 		=> 'apollo_activate_override_css',
		'std' 		=> APOLLO_THEME_ACTIVATE_OVERRIDE_CSS,
		'type' 		=> 'radio',
        'options'   => $activate_override_css_array,
	);
    
    /*************************************************************************/
	return $options;
}
